﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using FreeSql.DataAnnotations;

using tcm.entity.System;

namespace tcm.entity
{
    [Table(Name = "tcm_sys_user")]
    public class SysUser: BaseEntity
    {

        //账户登录名
        public string user_name { get; set; }

        //名称
        public string nick_name { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string email { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string password { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string phone { get; set; }

        /// <summary>
        /// 用户性别（1男 0女 2未知）
        /// </summary>
        public int sex { get; set; }

        /// <summary>
        /// 帐号状态（1正常 0停用）
        /// </summary>
        public int status { get; set; }

        /// <summary>
        /// 删除标志（0代表存在 1代表删除）
        /// </summary> 
        public int is_delete { get; set; }

        /// <summary>
        /// 最后登录IP
        /// </summary>
        public string login_ip { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime login_date { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string remark { get; set; }

        /// <summary>
        /// 登录token
        /// </summary>
        public string token { get; set; }

        #region 表额外字段
        public bool IsAdmin()
        {
            return IsAdmin(id);
        }
        public static bool IsAdmin(long userId)
        {
            return 1 == userId;
        }

        #endregion
    }
}

